<template>
  <div class="tjc">
    <div class="head">
      <div class="tit">车辆待解决告警</div>
      <!-- <div class="opt">
        <el-select v-model="state.pm.type" @change="getData">
          <el-option label="车辆" value="vehicle" />
          <el-option label="船舶" value="ship" />
        </el-select>
      </div> -->
    </div>
    <div class="ec" v-loading="state.loading">
      <div class="row1 row">
        <div class="c1" style="color:#ffffff;">{{ state.pm.type == 'vehicle' ? '车牌号' : '舷号' }}</div>
        <div class="c2">告警详情</div>
        <div class="c3">状态</div>
        <div class="c4">操作</div>
      </div>
      <div class="ecc">
        <div class="row1" v-for="(item, index) in state.data" :key="index">
          <div class="c1">{{ item.pnorlp }}</div>
          <div class="c2">{{ item.alarmDetail }}</div>
          <div class="c3">{{ item.dealFlag == 0 ? '未办结' : '已办结' }}</div>
          <div class="c4">
            <div :class="'btn' + item.dealFlag" @click="over(item)">办理完结</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
const state = reactive({
  pm: { type: 'vehicle' },
  data: [],
  myChart: null
})
const getData = () => {
  useApi.post("/arhome/dashboard/alarm", { type: state.pm.type }).then((res) => {
    state.data = res.data.eventlist
  });
}
const over = (item) => {
  if (item.dealFlag == 0) {
    useApi.post("/arhome/dashboard/dealalarm", { eventId: item.eventId, dealFlag: 1 }).then((res) => {
      getData()
    });
  }
}
onMounted(() => {
  getData()
})
</script>

<style lang="scss" scoped>
.tjc {
  width: 380px;
  height: 282px;
  background-image: url('/images/bgtj.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  padding: 10px;
}

.head {
  display: flex;
  height: 30px;
  margin-top: 10px;
  border-bottom: 1px solid #5FB1E8;

  .tit {
    margin-left: 100px;
    width: 180px;
    display: flex;
    justify-content: center;
    font-weight: 500;
    font-size: 16px;
    color: #FFFFFF;
    line-height: 22px;
  }

  .opt {
    width: 100px;
    text-align: right;
  }
}

.ec {
  margin-top: 2px;
  height: 215px;

  .row {
    background: linear-gradient(-148deg, rgba(46, 233, 255, 0.34) 0%, #0F7BC480 100%);
  }

  .row1 {
    height: 36px;
    display: flex;

    .c1 {
      width: 125px;
      display: flex;
      align-items: center;
      padding-left: 15px;
      font-weight: bold;
      font-size: 14px;
      color: #FFAD1E;
    }

    .c2 {
      width: 120px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: bold;
      font-size: 14px;
      color: #ffffff;
    }

    .c3 {
      width: 50px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: bold;
      font-size: 14px;
      color: #ffffff;
    }

    .c4 {
      width: 80px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: bold;
      font-size: 14px;
      color: #ffffff;

      .btn0 {
        padding: 2px 5px;
        background: linear-gradient(117deg, #5CCFEA 0%, #5BA9DD 100%);
        border-radius: 4px;
        cursor: pointer;
      }

      .btn1 {
        padding: 2px 5px;
        background: #0F78B0;
        border-radius: 4px;
      }
    }
  }

  .ecc {
    height: 180px;
    overflow-y: auto;
  }
}

/* 针对WebKit内核的自定义 */
::-webkit-scrollbar {
  width: 2px;
  height: 2px;
}

::-webkit-scrollbar-track {
  background-color: #0F7BC4cc;
}

::-webkit-scrollbar-thumb {
  background-color: #f0f0f0;
  border-radius: 10px;
}

/* 针对Firefox的自定义 */
html {
  scrollbar-color: #f0f0f0 #0F7BC4cc;
  scrollbar-width: thin;
}

:deep(.el-select) {
  width: 80px;
  margin-top: -4px;
  --el-input-text-color: #ffffff;
  --el-select-input-color: #ffffff;

  .el-select__wrapper {
    background: transparent;
    color: #FFFFFF;
    border: none;
    box-shadow: none;
    border-radius: 0px !important;
  }
}
</style>